<?php

namespace App\Http\Controllers\Admin;

use App;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Model\FriendshipLink;


class FriendshipLinkController extends Controller
{

    public function index(Request $request)
    {
        return view('admin.link.index');
    }
    //添加
    public  function create(){

        //标签
        return view('admin.link.add');
    }
    //添加业务
    public  function store(Request $request){

        $param=$request->input();
        if(empty($param['id'])){
            $friendship_link=new FriendshipLink();
            $friendship_link->create($param);
            return respone_return(200,'添加成功');
        }else{
            $friendship_link=FriendshipLink::find($param['id']);
            //修改
            $link=set_attributes($friendship_link,$param);
            if($link->save()){
                return respone_return(200,'修改成功');
            }
        }
        return  respone_return(0,'操作失败');
    }
    //删除
    public  function delete(Request $request){
        $ids=$request->input('ids');
        if(FriendshipLink::destroy($ids)){
            return respone_return('200','删除成功');
        }else{
            return respone_return('0','删除失败');
        }
    }


}
